package com.example.sunjian.myapplication.lrucache;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.util.LruCache;

/**
 * 作者：sunjian on 16/7/2 16:30
 * 邮箱：sunjian@cyhz.com
 */
public class LurCacheDemoActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        int maxMemory = (int) Runtime.getRuntime().maxMemory();
        int mCacheSize = maxMemory / 8;
        LruCache<String,String> cache = new LruCache<>(mCacheSize);
        cache.put("test","cahche test");//存储数据
        String str = cache.get("test");// 获取数据
        cache.evictAll();//清空数据
        Log.e("sj","print:"+str);
    }
}
